﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace Epitech.Krisk.Kinect.Cursor
{
    public class MouseHook
    {
        [DllImport("user32.dll")]
        private static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);
        private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
        private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;

        internal static void SendClick()
        {
            SendDown();
            SendUp();
        }

        internal static void SendUp()
        {
            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new System.IntPtr());
        }
        internal static void SendDown()
        {
            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, new System.IntPtr());
        }

        internal static void MoveMouse(System.Drawing.Point p)
        {
            System.Windows.Forms.Cursor.Position = new System.Drawing.Point(p.X, p.Y);
        }
    }

}
